import { onMounted, onUnmounted, ref } from "vue";
export default function () {
    let isFixed = ref(false);
    function scrollFn() {
        let scrollHeight =
            document.documentElement.scrollTop || document.body.scrollTop;

        if (scrollHeight > 50) {
            isFixed.value = true;
        } else {
            isFixed.value = false;
        }
    }

    onMounted(() => {
        window.addEventListener("scroll", scrollFn);
    });
    onUnmounted(() => {
        window.removeEventListener("scroll", scrollFn);
    });
    return { isFixed };
}
